/**
 * 
 */
package com.ez.supervise.util;

import java.text.DecimalFormat;

/**
 * @author searph.wang
 * @email searph.wang@gmail.com
 * @Created at Apr 1, 2010
 * 
 */
public class Format {
    
    public static DecimalFormat   COMMON_FORMAT = new DecimalFormat("######0.00");
    
    public static String format(Number n){
	if(n == null){
	    return "0.00";
	} else {
	    return COMMON_FORMAT.format(n);
	}
    }
    public static String format(Double n, String queryType){
	if("point".equals(queryType)){
	    if(n == null){
		    return "0.00";
		} else {
		    return COMMON_FORMAT.format(n);
		}
	} else {
	    if(n == null){
		    return "0";
		} else {
		    return String.valueOf(n.longValue());
		}
	}
	
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
	System.out.println(format(90));
	Double a = null;
	System.out.println( String.valueOf(a.longValue()));
    }

}
